<%--
  Created by IntelliJ IDEA.
  User: dailyblue
  Date: 2025/7/15
  Time: 16:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    // 存放
    application.setAttribute("A", "application存放的a");
    application.setAttribute("B", "application存放的b");
    application.setAttribute("C", "application存放的c");
    // 删除
    application.removeAttribute("B");
    // 获取
    Object a = application.getAttribute("A");
    Object b = application.getAttribute("B");
    Object c = application.getAttribute("C");
    out.print("a:" + a + "<br/>");
    out.print("b:" + b + "<br/>");
    out.print("c:" + c + "<br/>");
%>
<hr/>
<%
    // 四大容器：page容器、request容器、session容器以及application容器 生命周期不同
    pageContext.setAttribute("M1", "page容器中的M");
    request.setAttribute("M2", "request容器中的M");
    session.setAttribute("M3", "session容器中的M");
    application.setAttribute("M4", "application容器中的M");
%>
<%=pageContext.getAttribute("M1")%>
<br/>
<%=request.getAttribute("M2")%>
<br/>
<%=session.getAttribute("M3")%>
<br/>
<%=application.getAttribute("M4")%>
<br/>
<%
    // request.getRequestDispatcher("6-2.jsp").forward(request, response);
    response.sendRedirect("6-2.jsp");
%>
</body>
</html>
